//
//  ProblemDetailModel.m
//  Utils
//
//  Created by enghou on 2018/4/18.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "ProblemDetailModel.h"

@implementation ProblemDetailModel
-(instancetype)initWithSourceDict:(NSDictionary *)dict{
    self = [super initWithSourceDict:dict];
    if (self) {
        NSDictionary *data = [dict objectForKey:@"data"];
        self.event_name = [self contentForKey:@"name" withSource:data];
        NSDictionary *org = [data objectForKey:@"occurOrg"];
        self.orgName = [self contentForKey:@"orgName" withSource:org];
        self.occur_place = [self contentForKey:@"occurPlace" withSource:data];
        self.occur_time = [self contentForKey:@"occurDate" withSource:data];
        self.related_company = [self contentForKey:@"relatedUnit" withSource:data];
        self.realted_count = [self contentForKey:@"relatePeopleCount" withSource:data];
        self.mainCharacters = [self contentForKey:@"mainCharacters" withSource:data];
        self.event_type = [self contentForKey:@"issueTypeName" withSource:data];
        NSDictionary *kind = [data objectForKey:@"issueKind"];
        self.event_scale = [self contentForKey:@"displayName" withSource:kind];
        NSDictionary *source = [data objectForKey:@"eventSource"];
        self.event_source = [self contentForKey:@"displayName" withSource:source];
        self.event_desc = [self contentForKey:@"issueContent" withSource:data];
        self.evaluateOpition = [self contentForKey:@"evaluateOpinion" withSource:data];
        self.developForecast = [self contentForKey:@"developForecast" withSource:data];
        self.adjustMeasures = [self contentForKey:@"adjustMeasures" withSource:data];
        NSMutableArray *array = [NSMutableArray array];
        NSArray *files = [data objectForKey:@"files"];
        [files enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) {
            FileItemModel *model = [[FileItemModel alloc]initWithSource:obj];
            [array addObject:model];
        }];
        self.files = array;
    }
    return self;
}
@end
